package edu.fourtwelve.server;

//import javax.crypto.SecretKey;
import java.security.PublicKey;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;

/**
 *
 * @author Christopher C. Hunt
 */
public class Session {

    private static final Logger log = Logger.getLogger(Session.class.getName());
    private final int sessionNum;
    private final String usrName;
    private final SecretKey skey;
    private final PublicKey puKey;
    private final IvParameterSpec ivp;
    private boolean authenticated = false;
    
    public Session(int sessionNum, String usrName, SecretKey skey, IvParameterSpec ivp, PublicKey puKey) {
        this.sessionNum = sessionNum;
        this.usrName = usrName;
        this.puKey = puKey;
        this.skey = skey;
        this.ivp = ivp;
        
        if (log.isLoggable(Level.FINE)) {
            log.log(Level.FINE, "Session Num = {0} UserName = {1}", new Object[]{sessionNum, usrName});
        }
    }
    
    public boolean isAuthenticated() {
        return authenticated;
    }
    
    public void setAuthenticated(boolean authenticated) {
        this.authenticated = authenticated;
    }
    
    public String getUserName() {
        return usrName;
    }
    
    public SecretKey getSecretKey() {
        return skey;
    }
    
    public IvParameterSpec getIvParameterSpec() {
        return ivp;
    }
    
    public PublicKey getPublicKey() {
        return puKey;
    }
}

